/**
 * 输入事件类型
 */
export enum InputEventType {
    // 键盘事件
    KEY_DOWN = 'keydown',
    KEY_UP = 'keyup',
    KEY_PRESS = 'keypress',
    
    // 鼠标事件
    MOUSE_DOWN = 'mousedown',
    MOUSE_UP = 'mouseup',
    MOUSE_MOVE = 'mousemove',
    MOUSE_WHEEL = 'wheel',
    MOUSE_ENTER = 'mouseenter',
    MOUSE_LEAVE = 'mouseleave',
    
    // 触摸事件
    TOUCH_START = 'touchstart',
    TOUCH_END = 'touchend',
    TOUCH_MOVE = 'touchmove',
    TOUCH_CANCEL = 'touchcancel'
}

/**
 * 键盘按键状态
 */
export interface KeyState {
    isPressed: boolean;
    isRepeated: boolean;
    timestamp: number;
}

/**
 * 鼠标按钮状态
 */
export enum MouseButton {
    LEFT = 0,
    MIDDLE = 1,
    RIGHT = 2,
    BACK = 3,
    FORWARD = 4
}

/**
 * 鼠标状态
 */
export interface MouseState {
    x: number;
    y: number;
    buttons: Map<MouseButton, boolean>;
    wheelDelta: number;
    isInCanvas: boolean;
}

/**
 * 触摸点状态
 */
export interface TouchPoint {
    id: number;
    x: number;
    y: number;
    force: number;
    timestamp: number;
}

/**
 * 触摸状态
 */
export interface TouchState {
    points: Map<number, TouchPoint>;
    changedPoints: TouchPoint[];
}

/**
 * 输入事件数据
 */
export interface InputEventData {
    type: InputEventType;
    target: EventTarget;
    timestamp: number;
    preventDefault: () => void;
    stopPropagation: () => void;
    
    // 键盘事件特有
    key?: string;
    code?: string;
    keyCode?: number;
    repeat?: boolean;
    
    // 鼠标事件特有
    button?: MouseButton;
    buttons?: number;
    clientX?: number;
    clientY?: number;
    movementX?: number;
    movementY?: number;
    wheelDelta?: number;
    
    // 触摸事件特有
    touches?: TouchPoint[];
    changedTouches?: TouchPoint[];
}

/**
 * 输入事件回调函数类型
 */
export type InputEventHandler = (event: InputEventData) => void;

/**
 * 输入管理器配置选项
 */
export interface InputManagerOptions {
    /**
     * 是否启用键盘输入
     */
    enableKeyboard?: boolean;
    
    /**
     * 是否启用鼠标输入
     */
    enableMouse?: boolean;
    
    /**
     * 是否启用触摸输入
     */
    enableTouch?: boolean;
    
    /**
     * 是否阻止默认的触摸行为（如滚动）
     */
    preventDefaultTouch?: boolean;
    
    /**
     * 是否阻止默认的键盘行为（如F5刷新）
     */
    preventDefaultKeyboard?: boolean;
    
    /**
     * 是否阻止默认的鼠标行为（如右键菜单）
     */
    preventDefaultMouse?: boolean;
} 